﻿namespace System

open System

type TryResult<'a, 'b> when 'a :> Exception =
    | Error of 'a
    | Value of 'b
    
    static member TryParse result =
        match result with
        | false, _ -> Error(FormatException())
        | true, value -> Value(value)